/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.ItemDao;
import com.taobao.snowsnow.hibernate.pojo.Item;
import com.taobao.snowsnow.hibernate.service.ItemService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class ItemServiceImpl extends BaseServiceImpl implements ItemService {
	private ItemDao idao;
	
	public List<Item> findAll() {
		try {
			return idao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public Item findById(int id) {
		try {
			return idao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
		}
		return null;
	}
	
	public List<Item> findByName(String name) {
		try {
			return idao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
		}
		return null;
	}

	public long getTotal()  {
		try {
			return idao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
		}
		return -1;
	}

	public List<Item> paging(int page, int limit)  {
		try {
			return idao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
		}
		return null;
	}

	@Override
	public Item getFirstObject() {
		try {
			return idao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Item getFirstObject()");
		}
		return null;
	}

	@Override
	public Item getLastObject() {
		try {
			return idao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("Item getLastObject()");
		}
		return null;
	}

	public ItemDao getIdao() {
		return idao;
	}

	public void setIdao(ItemDao idao) {
		this.idao = idao;
	}
}
